home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / dev / misc / new_PCQ_lib.lha / Update_PCQ.lib / DOS.i next >
Text File  |  1995-04-23  |  16KB  |  510 lines

  1. {
  2.         DOS.i for PCQ Pascal
  3.  
  4.         Standard C header for AmigaDOS
  5.  
  6.  -- This is Include:dos/dos.i for PCQ-Pascal, revision from April 23, 1995
  7.  -- ( NameFromFH corrected : Buffer is now direct String, no global VAR )
  8.  
  9. }
  10.  
  11. {$I   "Include:Exec/Types.i"}
  12.  
  13. Const
  14.  
  15.     DOSNAME     = "dos.library";
  16.  
  17. { Predefined Amiga DOS global constants }
  18.  
  19.     DOSTRUE     = -1;
  20.     DOSFALSE    = 0;
  21.  
  22. { Mode parameter to Open() }
  23.  
  24.     MODE_OLDFILE        = 1005;         { Open existing file read/write
  25.                                           positioned at beginning of file. }
  26.     MODE_NEWFILE        = 1006;         { Open freshly created file (delete
  27.                                           old file) read/write }
  28.     MODE_READWRITE      = 1004;         { Open old file w/exclusive lock }
  29.  
  30. { Relative position to Seek() }
  31.  
  32.     OFFSET_BEGINNING    = -1;           { relative to Begining Of File }
  33.     OFFSET_CURRENT      = 0;            { relative to Current file position }
  34.     OFFSET_END          = 1;            { relative to End Of File }
  35.  
  36.     BITSPERBYTE         = 8;
  37.     BYTESPERLONG        = 4;
  38.     BITSPERLONG         = 32;
  39.     MAXINT              = $7FFFFFFF;
  40.     MININT              = $80000000;
  41.  
  42. { Passed as type to Lock() }
  43.  
  44.     SHARED_LOCK         = -2;           { File is readable by others }
  45.     ACCESS_READ         = -2;           { Synonym }
  46.     EXCLUSIVE_LOCK      = -1;           { No other access allowed }
  47.     ACCESS_WRITE        = -1;           { Synonym }
  48.  
  49. Type
  50.  
  51.     FileHandle  = Address;
  52.     FileLock    = Address;
  53.  
  54.     DateStampRec = record
  55.         ds_Days         : Integer;      { Number of days since Jan. 1, 1978 }
  56.         ds_Minute       : Integer;      { Number of minutes past midnight }
  57.         ds_Tick         : Integer;      { Number of ticks past minute }
  58.     end;
  59.     DateStampPtr = ^DateStampRec;
  60.  
  61. Const
  62.  
  63.     TICKS_PER_SECOND    = 50;           { Number of ticks in one second }
  64.  
  65. Type
  66.  
  67. { Returned by Examine() and ExInfo(), must be on a 4 byte boundary }
  68.  
  69.     FileInfoBlock = record
  70.         fib_DiskKey     : Integer;
  71.         fib_DirEntryType : Integer;
  72.                         { Type of Directory. If < 0, then a plain file.
  73.                           If > 0 a directory }
  74.         fib_FileName    : Array [0..107] of Char;
  75.                         { Null terminated. Max 30 chars used for now }
  76.         fib_Protection  : Integer;
  77.                         { bit mask of protection, rwxd are 3-0. }
  78.         fib_EntryType   : Integer;
  79.         fib_Size        : Integer;      { Number of bytes in file }
  80.         fib_NumBlocks   : Integer;      { Number of blocks in file }
  81.         fib_Date        : DateStampRec; { Date file last changed }
  82.         fib_Comment     : Array [0..79] of Char;
  83.                         { Null terminated comment associated with file }
  84.         fib_Reserved    : Array [0..35] of Char;
  85.     end;
  86.     FileInfoBlockPtr = ^FileInfoBlock;
  87.  
  88.  
  89. Const
  90.  
  91. { FIB stands for FileInfoBlock }
  92.  
  93. { FIBB are bit definitions, FIBF are field definitions }
  94.  
  95.     FIBB_SCRIPT         = 6;    { program is a script (execute) file }
  96.     FIBB_PURE           = 5;    { program is reentrant and rexecutable}
  97.     FIBB_ARCHIVE        = 4;    { cleared whenever file is changed }
  98.     FIBB_READ           = 3;    { ignored by old filesystem }
  99.     FIBB_WRITE          = 2;    { ignored by old filesystem }
  100.     FIBB_EXECUTE        = 1;    { ignored by system, used by Shell }
  101.     FIBB_DELETE         = 0;    { prevent file from being deleted }
  102.     FIBF_SCRIPT         = 64;
  103.     FIBF_PURE           = 32;
  104.     FIBF_ARCHIVE        = 16;
  105.     FIBF_READ           = 8;
  106.     FIBF_WRITE          = 4;
  107.     FIBF_EXECUTE        = 2;
  108.     FIBF_DELETE         = 1;
  109.  
  110.  
  111. Type
  112.  
  113. { returned by Info(), must be on a 4 byte boundary }
  114.  
  115.     InfoData = record
  116.         id_NumSoftErrors        : Integer;      { number of soft errors on disk }
  117.         id_UnitNumber           : Integer;      { Which unit disk is (was) mounted on }
  118.         id_DiskState            : Integer;      { See defines below }
  119.         id_NumBlocks            : Integer;      { Number of blocks on disk }
  120.         id_NumBlocksUsed        : Integer;      { Number of block in use }
  121.         id_BytesPerBlock        : Integer;
  122.         id_DiskType             : Integer;      { Disk Type code }
  123.         id_VolumeNode           : BPTR;         { BCPL pointer to volume node }
  124.         id_InUse                : Integer;      { Flag, zero if not in use }
  125.     end;
  126.     InfoDataPtr = ^InfoData;
  127.  
  128. Const
  129.  
  130. { ID stands for InfoData }
  131.  
  132.         { Disk states }
  133.  
  134.     ID_WRITE_PROTECTED  = 80;   { Disk is write protected }
  135.     ID_VALIDATING       = 81;   { Disk is currently being validated }
  136.     ID_VALIDATED        = 82;   { Disk is consistent and writeable }
  137.  
  138. CONST
  139.  ID_NO_DISK_PRESENT     = -1;
  140.  ID_UNREADABLE_DISK     = $42414400;   { 'BAD\0' }
  141.  ID_DOS_DISK            = $444F5300;   { 'DOS\0' }
  142.  ID_FFS_DISK            = $444F5301;   { 'DOS\1' }
  143.  ID_NOT_REALLY_DOS      = $4E444F53;   { 'NDOS'  }
  144.  ID_KICKSTART_DISK      = $4B49434B;   { 'KICK'  }
  145.  ID_MSDOS_DISK          = $4d534400;   { 'MSD\0' }
  146.  
  147. { Errors from IoErr(), etc. }
  148.  ERROR_NO_FREE_STORE              = 103;
  149.  ERROR_TASK_TABLE_FULL            = 105;
  150.  ERROR_BAD_TEMPLATE               = 114;
  151.  ERROR_BAD_NUMBER                 = 115;
  152.  ERROR_REQUIRED_ARG_MISSING       = 116;
  153.  ERROR_KEY_NEEDS_ARG              = 117;
  154.  ERROR_TOO_MANY_ARGS              = 118;
  155.  ERROR_UNMATCHED_QUOTES           = 119;
  156.  ERROR_LINE_TOO_LONG              = 120;
  157.  ERROR_FILE_NOT_OBJECT            = 121;
  158.  ERROR_INVALID_RESIDENT_LIBRARY   = 122;
  159.  ERROR_NO_DEFAULT_DIR             = 201;
  160.  ERROR_OBJECT_IN_USE              = 202;
  161.  ERROR_OBJECT_EXISTS              = 203;
  162.  ERROR_DIR_NOT_FOUND              = 204;
  163.  ERROR_OBJECT_NOT_FOUND           = 205;
  164.  ERROR_BAD_STREAM_NAME            = 206;
  165.  ERROR_OBJECT_TOO_LARGE           = 207;
  166.  ERROR_ACTION_NOT_KNOWN           = 209;
  167.  ERROR_INVALID_COMPONENT_NAME     = 210;
  168.  ERROR_INVALID_LOCK               = 211;
  169.  ERROR_OBJECT_WRONG_TYPE          = 212;
  170.  ERROR_DISK_NOT_VALIDATED         = 213;
  171.  ERROR_DISK_WRITE_PROTECTED       = 214;
  172.  ERROR_RENAME_ACROSS_DEVICES      = 215;
  173.  ERROR_DIRECTORY_NOT_EMPTY        = 216;
  174.  ERROR_TOO_MANY_LEVELS            = 217;
  175.  ERROR_DEVICE_NOT_MOUNTED         = 218;
  176.  ERROR_SEEK_ERROR                 = 219;
  177.  ERROR_COMMENT_TOO_BIG            = 220;
  178.  ERROR_DISK_FULL                  = 221;
  179.  ERROR_DELETE_PROTECTED           = 222;
  180.  ERROR_WRITE_PROTECTED            = 223;
  181.  ERROR_READ_PROTECTED             = 224;
  182.  ERROR_NOT_A_DOS_DISK             = 225;
  183.  ERROR_NO_DISK                    = 226;
  184.  ERROR_NO_MORE_ENTRIES            = 232;
  185. { added for 1.4 }
  186.  ERROR_IS_SOFT_LINK               = 233;
  187.  ERROR_OBJECT_LINKED              = 234;
  188.  ERROR_BAD_HUNK                   = 235;
  189.  ERROR_NOT_IMPLEMENTED            = 236;
  190.  ERROR_RECORD_NOT_LOCKED          = 240;
  191.  ERROR_LOCK_COLLISION             = 241;
  192.  ERROR_LOCK_TIMEOUT               = 242;
  193.  ERROR_UNLOCK_ERROR               = 243;
  194.  
  195. { error codes 303-305 are defined in dosasl.h }
  196.  
  197. { Values returned by SameLock() }
  198.  LOCK_SAME             =  0;
  199.  LOCK_SAME_HANDLER     =  1;       { actually same volume }
  200.  LOCK_DIFFERENT        =  -1;
  201.  
  202. { types for ChangeMode() }
  203.  CHANGE_LOCK    = 0;
  204.  CHANGE_FH      = 1;
  205.  
  206. { Values for MakeLink() }
  207.  LINK_HARD      = 0;
  208.  LINK_SOFT      = 1;       { softlinks are not fully supported yet }
  209.  
  210. { values returned by ReadItem }
  211.  ITEM_EQUAL     = -2;              { "=" Symbol }
  212.  ITEM_ERROR     = -1;              { error }
  213.  ITEM_NOTHING   = 0;               { *N, ;, endstreamch }
  214.  ITEM_UNQUOTED  = 1;               { unquoted item }
  215.  ITEM_QUOTED    = 2;               { quoted item }
  216.  
  217. { types for AllocDosObject/FreeDosObject }
  218.  DOS_FILEHANDLE        =  0;       { few people should use this }
  219.  DOS_EXALLCONTROL      =  1;       { Must be used to allocate this! }
  220.  DOS_FIB               =  2;       { useful }
  221.  DOS_STDPKT            =  3;       { for doing packet-level I/O }
  222.  DOS_CLI               =  4;       { for shell-writers, etc }
  223.  DOS_RDARGS            =  5;       { for ReadArgs if you pass it in }
  224.  
  225.  
  226.  
  227. Procedure DOSClose(filehand : FileHandle);
  228.     External;
  229.  
  230. Function CreateDir(name : String) : FileLock;
  231.     External;
  232.  
  233. Function CurrentDir(lock : FileLock) : FileLock;
  234.     External;
  235.  
  236. Procedure DateStamp(var ds : DateStampRec);
  237.     External;
  238.  
  239. Procedure Delay(ticks : Integer);
  240.     External;
  241.  
  242. Function DeleteFile(name : String) : Boolean;
  243.     External;
  244.  
  245. Function DupLock(lock : FileLock) : FileLock;
  246.     External;
  247.  
  248. Function Examine(lock : FileLock; info : FileInfoBlockPtr) : Boolean;
  249.     External;
  250.  
  251. Function Execute(command : String; InFile, OutFile : FileHandle) : Boolean;
  252.     External;
  253.  
  254. Procedure DOSExit(code : Integer);
  255.     External;
  256.  
  257. Function ExNext(lock : FileLock; info : FileInfoBlockPtr) : Boolean;
  258.     External;
  259.  
  260. Function Info(lock : FileLock; params : InfoDataPtr) : Boolean;
  261.     External;
  262.  
  263. Function IoErr : Integer;
  264.     External;
  265.  
  266. Function DOSInput : FileHandle;
  267.     External;
  268.  
  269. Function IsInteractive(f : FileHandle) : Boolean;
  270.     External;
  271.  
  272. Function Lock(name : String; accessmode : Integer) : FileLock;
  273.     External;
  274.  
  275. Function DOSOpen(name : String; accessmode : Integer) : FileHandle;
  276.     External;
  277.  
  278. Function DOSOutput : FileHandle;
  279.     External;
  280.  
  281. Function ParentDir(lock : FileLock) : FileLock;
  282.     External;
  283.  
  284. Function DOSRead(f : FileHandle; buffer : Address; length : Integer) : Integer;
  285.     External;
  286.  
  287. Function Rename(oldname, newname : String) : Boolean;
  288.     External;
  289.  
  290. Function Seek(f : FileHandle; pos : Integer; mode : Integer) : Integer;
  291.     External;
  292.  
  293. Function SetComment(name : String; comment : String) : Boolean;
  294.     External;
  295.  
  296. Function SetProtection(name : String; mask : Integer) : Boolean;
  297.     External;
  298.  
  299. Procedure UnLock(lock : FileLock);
  300.     External;
  301.  
  302. Function WaitForChar(f : FileHandle; timeout : Integer) : Boolean;
  303.     External;
  304.  
  305. Function DOSWrite(f : FileHandle; buffer : Address; len : Integer) : Integer;
  306.     External;
  307.  
  308.  
  309. { OS2.0 }
  310.  
  311. FUNCTION AddBuffers(Name : String; Buffers : Integer) : Boolean;
  312.     External;
  313.  
  314. FUNCTION AddPart(Path1, Path2 : String; Bytes : Integer) : Boolean;
  315.     External;
  316.  
  317. FUNCTION AllocDosObject(ObjectType : Integer; Tags : Address) : Address;
  318.     External;
  319.  
  320. FUNCTION AssignAdd(name : String; Datei : FileLock) : Boolean;
  321.     External;
  322.  
  323. FUNCTION AssignLate(name1, name2 : String) : Boolean;
  324.     External;
  325.  
  326. FUNCTION AssignLock(name : String; Datei : FileLock) : Boolean;
  327.     External;
  328.  
  329. FUNCTION AssignPath(name1, name2 : String) : Boolean;
  330.     External;
  331.  
  332. FUNCTION ChangeMode(Mode : Integer; Datei : Address; newMode : Integer) : Boolean;
  333.     External;                       { Datei is a FileLock OR a FileHandle }
  334.  
  335. FUNCTION CheckSignal(Signal : Integer) : Integer;
  336.     External;
  337.  
  338. FUNCTION CompareDates(First, Second : DateStampPtr) : Integer;
  339.     External;
  340.  
  341. FUNCTION DupLockFromFH(Datei : FileHandle) : FileLock;
  342.     External;
  343.  
  344. FUNCTION ErrorReport(ErrorCode, ReportType : Integer; Param : Address; HandlerID : Address) : Boolean;
  345.     External;                                                          { HandlerID is a MsgPortPtr }
  346.  
  347. FUNCTION ExamineFH(Datei : FileHandle; FIB : FileInfoBlockPtr) : Boolean;
  348.     External;
  349.  
  350. FUNCTION Fault(Code : Integer; Txt : String; VAR Buffer : String; BufferSize : Integer) : Integer;
  351.     External;
  352.  
  353. FUNCTION FGetC(Datei : FileHandle) : Char;
  354.     External;
  355.  
  356. FUNCTION FGets(Datei : FileHandle; VAR Buffer : String; BufferSize : Integer) : String;
  357.     External;
  358.  
  359. FUNCTION FilePart(Path : String) : Char;
  360.     External;
  361.  
  362. FUNCTION Flush(Datei : FileHandle) : Boolean;
  363.     External;
  364.  
  365. FUNCTION Format(drive, name : String; DOSType : Integer) : Boolean;
  366.     External;
  367.  
  368. FUNCTION FPutC(Datei : FileHandle; c : Char) : Integer;
  369.     External;
  370.  
  371. FUNCTION FPuts(Datei : FileHandle; str : String) : Boolean;
  372.     External;
  373.  
  374. FUNCTION FRead(Datei : FileHandle; Buffer : Address; BlockSize, Blocks : Integer) : Integer;
  375.     External;
  376.  
  377. FUNCTION FWrite(Datei : FileHandle; Buffer : Address; BlockSize, Blocks : Integer) : Integer;
  378.     External;
  379.  
  380. PROCEDURE FreeDosObject(ObjectType : Integer; Object : Address);
  381.     External;
  382.  
  383. FUNCTION GetArgStr : String;
  384.     External;
  385.  
  386. FUNCTION GetCurrentDirName(VAR Buffer : String; BufferSize : Integer) : Boolean;
  387.     External;
  388.  
  389. FUNCTION GetProgramDir : FileLock;
  390.     External;
  391.  
  392. FUNCTION GetProgramName(VAR Buffer : String; BufferSize : Integer) : Boolean;
  393.     External;
  394.  
  395. FUNCTION GetPrompt(VAR Buffer : String; BufferSize : Integer) : Boolean;
  396.     External;
  397.  
  398. FUNCTION Inhibit(device : String; mode : Boolean) : Boolean;
  399.     External;
  400.  
  401. FUNCTION IsFileSystem(name : String) : Boolean;
  402.     External;
  403.  
  404. FUNCTION MakeLink(name : String; datei : Address; LinkType : Integer) : Boolean;
  405.     External;                   { LinkType=LINK_HARD : datei=FileLock
  406.                                 { LinkType=LINK_SOFT : Datei=String }
  407.  
  408. FUNCTION NameFromFH(Datei : FileHandle; Buffer : String; BufferSize : Integer) : Boolean;
  409.     External;
  410.  
  411. FUNCTION NameFromLock(Datei : FileLock; VAR Buffer : String; BufferSize : Integer) : Boolean;
  412.     External;
  413.  
  414. FUNCTION OpenFromLock(Datei : FileLock) : FileHandle;
  415.     External;
  416.  
  417. FUNCTION ParentOfFH(Datei : FileHandle) : FileLock;
  418.     External;
  419.  
  420. FUNCTION PathPart(Path : String) : Char;
  421.     External;
  422.  
  423. FUNCTION PrintFault(error : Integer; Str : String) : Boolean;
  424.     External;
  425.  
  426. FUNCTION PutStr(Str : String) : Boolean;
  427.     External;
  428.  
  429. FUNCTION ReadLink(procID : Address; datei : FileLock; name : String;
  430.                   VAR buffer : String; buffersize : Integer) : Boolean;
  431.     External;     { procID is a MsgPortPtr }
  432.  
  433. FUNCTION Relabel(device : String; newname : String) : Boolean;
  434.     External;
  435.  
  436. FUNCTION RemAssignList(name : String; datei : FileLock) : Boolean;
  437.     External;
  438.  
  439. FUNCTION RunCommand(SL : Address; stacksize : Integer; param : String; paramlen : Integer) : Integer;
  440.     External;
  441.  
  442. FUNCTION SameDevice(datei1, datei2 : FileLock) : Boolean;
  443.     External;
  444.  
  445. FUNCTION SameLock(datei1, datei2 : FileLock) : Integer;
  446.     External;
  447.  
  448. FUNCTION SelectInput(new : FileHandle) : FileHandle;
  449.     External;
  450.  
  451. FUNCTION SelectOutput(new : FileHandle) : FileHandle;
  452.     External;
  453.  
  454. FUNCTION SetArgStr(new : String) : String;
  455.     External;
  456.  
  457. FUNCTION SetCurrentDirName(path : String) : Boolean;
  458.     External;
  459.  
  460. FUNCTION SetFileDate(datei : String; date : DateStampPtr) : Boolean;
  461.     External;
  462.  
  463. FUNCTION SetFileSize(datei : FileHandle; new, mode : Integer) : Boolean;
  464.     External;
  465.  
  466. FUNCTION SetIoErr(new : Integer) : Integer;
  467.     External;
  468.  
  469. FUNCTION SetMode(datei : FileHandle; new : Integer) : Boolean;
  470.     External;
  471.  
  472. FUNCTION SetProgramDir(new : FileLock) : FileLock;
  473.     External;
  474.  
  475. FUNCTION SetProgramName(new : String) : Boolean;
  476.     External;
  477.  
  478. FUNCTION SetPrompt(prompt : String) : Boolean;
  479.     External;
  480.  
  481. FUNCTION SetVBuf(datei : FileHandle; VAR Buffer : String; bufmode, buffersize : Integer) : Boolean;
  482.     External;
  483.  
  484. FUNCTION SplitName(path : String; Separator : Char; VAR Buffer : String; start : Short; BufferSize : Integer) : Short;
  485.     External;
  486.  
  487. FUNCTION StrToLong(Str : String; VAR L : Address) : Integer;
  488.     External;
  489.  
  490. FUNCTION SystemTagList(command : String; tags : Address) : Integer;
  491.     External;
  492.  
  493. FUNCTION UnGetC(Datei : FileHandle; c : Integer) : Integer;
  494.     External;
  495.  
  496. FUNCTION VFPrintf(datei : FileHandle; str : String; objects : Address) : Integer;
  497.     External;
  498.  
  499. FUNCTION VFWritef(datei : FileHandle; str : String; objects : Address) : Integer;
  500.     External;
  501.  
  502. FUNCTION VPrintf(str : String; objects : Address) : Integer;
  503.     External;
  504.  
  505. FUNCTION WriteChars(buffer : String; num : Integer) : Integer;
  506.     External;
  507.  
  508.  
  509.  
  510.